interface List<E> {

  get(index: number): E

  add(e: E): void

  iterate(): void

  size(): number

}

class ArrayList<E> implements List<E> {

  array: Array<E>

  count: number

  constructor(length: number) {
    this.array = new Array<E>(length)
    this.count = 0
  }

  get(index: number): E {
    return this.array[index]
  }

  add(e: E): void {
    this.array[this.count] = e
    this.count++
  }

  iterate(): void {
    console.log(this.array.join(','))
  }

  size(): number {
    return this.count
  }

}

export {ArrayList}